package com.uni.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.uni.common.util.SystemConfig;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * 首页轮播图
 * @author yuyanzheng
 *
 */
@NoArgsConstructor
@Data
public class CarouselFigureDTO {
	private Long id;
	private String name;
	private String imageUrl;
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	private Date updateTime;
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	private Date createTime;
	private Integer type;
	private Integer order;
	
	public String getImageUrlAll() {
		if(StringUtils.isNotBlank(imageUrl) && ! imageUrl.startsWith("http")) {
			return SystemConfig.basePath + imageUrl;
		}
		return imageUrl;
	}
}